package homework;

public class Homework_P1M1_2 {

    public static void main(String[] args) {
        for (int i = 1;i <= 1000;i++) {
            if (isWanShu(i)) {
                System.out.print(i+" ");
            }
        }
    }
    public static boolean isWanShu(int num) {  //声明的布尔方法
        int total = 0;
        for (int j = 1;j < num;j++) {
            // 此时j为因子
            if (num % j == 0) {
                total += j;
            }
        }
        if (total == num) {
            return true;
        }
        return false;
    }
}